﻿@{
    ViewBag.Title = "RptPosDataDetail";
}

@section scripts
{   
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>  
    <script src="@Url.Content("~/Scripts/common/gridlayout.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/common/export.js")" type="text/javascript"></script>
}
<body>
   <form id="form1" runat="server" method="post" style="height: 100%">
    
    @Html.Partial("~/Views/Modular/ReportsToolbar.cshtml")
    
    <div id = "DivHeader">
        <table>
            <tr>
                <td width = "70px" align="right">时间段：</td>
                <td  width = "482px">
                    @Html.Partial("~/Views/Modular/dxDateTimeRange.cshtml")
                </td>
            </tr>
        </table>
        <table style="margin-bottom:4px;">
            <tr>
                <td width ="70px" height="30px" align="right">门店名称：</td>
                <td width ="190px" height="30px">    
                    @Html.Partial("~/Views/Modular/LookupStockInfo.cshtml")                      
                </td>
                <td width = "70px" height="30px" align="right">收银员：</td>
                <td width = "190px" height="30px">
                    @Html.Partial("~/Views/Modular/LookupUserInfo.cshtml")
                </td>
                <td width ="70px" height="30px" align="right">交班单号：</td>
                <td width ="150px" height="30px">
                    <input class="mini-textbox" name="FClassNo" style="width:150px; top: 0px; left: 0px;" />
                </td>
            </tr>
            <tr>
                <td width ="70px" height="30px" align="right">会员卡号：</td>
                <td width ="190px" height="30px">    
                    @Html.Partial("~/Views/Modular/LookupMember.cshtml")            
                </td>
                <td width ="70px" height="30px" align="right">商品名称：</td>
                <td width ="190px" height="30px">    
                    @Html.Partial("~/Views/Modular/LookupGoodInfo.cshtml")                      
                </td>
                <td width ="70px" height="30px" align="right">单据编号：</td>
                <td width ="150px" height="30px">
                    <input name="FBillNo" class="mini-textbox" style="width:150px;"/>
                </td>
            </tr>
            <tr>
                <td width ="70px" height="30px" align="right">导购员：</td>
                <td width ="190px" height="30px">    
                    @Html.Partial("~/Views/Modular/LookupGuider.cshtml")            
                </td>
                <td width ="70px" height="30px" align="right">供应商：</td>
                <td width ="190px" height="30px">    
                    @Html.Partial("~/Views/Modular/LookUpSupply.cshtml")                       
                </td>
                <td width ="70px" height="30px" align="right">销售类型：</td>
                <td width ="150px" height="30px">
                    <input id="comBillType" name ="FBillType" class="mini-combobox" style="width:150px;" 
                    showNullItem="false" required="true" allowInput="false" align="left" data ="dBillType"/>                      
                </td>
            </tr>
        </table>
    </div>
    <div class="mini-fit">
        <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;" borderStyle="border:1;"pageSize="15"
            url="../Report/GetBillDetail"
            allowCellSelect="true" allowCellEdit="true" showSummaryRow="true" ondrawsummarycell="onDrawSummaryCell"
            fitColumns="false" onrowdblclick="editBill" sortMode="client">
            <div property="columns">
                <div field="FBillNo" width="120" headerAlign="center">单据编号</div>    
                <div field="FDate" width="130px"  headerAlign="center" dateFormat="yyyy-MM-dd HH:mm:ss">单据日期</div> 
                <div field="FNumber" width="90" headerAlign="center">商品编码</div>
                <div field="FName" width="130" headerAlign="center">商品名称</div>
                <div field="FSpec" width="80" headerAlign="center">规格型号</div>
                <div field="FUnitName" width="40" headerAlign="center">单位</div>
                <div field="mFQty" name="mFQty" width="70" headerAlign="center"align="right" numberFormat="#,0.00#">数量</div>
                <div field="mFConvert" name="mFConvert" width="70" headerAlign="center"align="right">内装数</div>
                <div field="mFPrice" name="mFPrice" width="70" headerAlign="center"align="right" numberFormat="#,0.00#">原价</div>
                <div field="mFActualPrice" name="mFActualPrice" width="70" headerAlign="center"align="right" numberFormat="#,0.00#">实价</div>
                <div field="mFAmount" name="mFAmount" width="80" headerAlign="center"align="right" numberFormat="#,0.00#">应收金额</div>
                <div field="mFActualAmount" name="mFActualAmount" width="80" headerAlign="center"align="right" numberFormat="#,0.00#">实收金额</div>
                <div field="mFDisAmount" name="mFDisAmount" width="80" headerAlign="center"align="right" numberFormat="#,0.00#">折扣金额</div>
                <div field="FCode" width="100" headerAlign="center">商品条码</div>
                <div field="FMemberNumber" width="120" headerAlign="center">会员卡号</div>
                <div field="FMemberName" width="80" headerAlign="center">会员姓名</div>
                <div field="FClassNo" width="120" headerAlign="center">交班单号</div>
                <div field="FStockName" width="100" headerAlign="center">门店名称</div>
                <div field="FUserName" width="80" headerAlign="center">收银员</div>
                <div field="FEmpNumber" width="90" headerAlign="center">导购员编码</div>
                <div field="FEmpName" width="90" headerAlign="center">导购员名称</div>
                <div field="FSuppNumber" width="90" headerAlign="center">供应商编码</div>
                <div field="FSuppName" width="190" headerAlign="center">供应商名称</div>
            </div>
        </div>  
    </div>
    
    <script type="text/javascript">
        var dBillType = [{ "id": "0", "text": "全部" },
                         { "id": "1", "text": "零售" },
                         { "id": "2", "text": "退货" },
                         { "id": "3", "text": "赠送" },
                         { "id": "4", "text": "积分兑换" }]

        mini.parse();
        var form = new mini.Form("form1");
        var grid = mini.get("datagrid1");
        var uID = parent.window.getSystemAppID();
        var hdatatype = getQueryString("datatype");
        var sumFields = "mFQty,mFActualAmount,mFAmount,mFDisAmount";

        function FormShown() {
            var nowDate = new Date();
            mini.getbyName("FDateTime1").setValue(dateToStr(nowDate, 1));
            mini.getbyName("FDateTime2").setValue(dateToStr(nowDate, 2));
            mini.getbyName("FBillType").select(0);
            LoadData();
        }

        function clearloca() {
            mini.getbyName("FMemberNumber").setValue("");
            mini.getbyName("FMemberNumber").setText(""); 
            mini.getbyName("FMemberName").setValue("");
            mini.getbyName("FUserID").setValue("");
            mini.getbyName("FUserID").setText("");
            mini.getbyName("FUserName").setValue("");
            mini.getbyName("FStockID").setValue("");
            mini.getbyName("FStockID").setText("");
            mini.getbyName("FStockName").setValue("");
            mini.getbyName("FClassNumber").setValue("");
            mini.getbyName("FClassNumber").setText("");
            mini.getbyName("FGoodItemID").setValue("");
            mini.getbyName("FClassNo").setValue("");
            mini.getbyName("FBillNo").setValue("");            
            mini.getbyName("FSupplyItemID").setValue("");
            mini.getbyName("FSupplyItemID").setText("");
            mini.getbyName("FSupplyName").setValue("");
            mini.getbyName("FGuiderNumber").setValue("");
            mini.getbyName("FGuiderNumber").setText("");
            mini.getbyName("FGuiderName").setValue("");
            var nowDate = new Date();
            mini.getbyName("FDateTime1").setValue(dateToStr(nowDate, 1));
            mini.getbyName("FDateTime2").setValue(dateToStr(nowDate, 2));
            mini.getbyName("comdatasel").setValue(0);
        }

        function LoadData() {
            var cDateTime1 = mini.getbyName("FDateTime1").getFormValue();
            var cDateTime2 = mini.getbyName("FDateTime2").getFormValue();
            var mBillNo = mini.getbyName("FBillNo").getValue();
            var mClassNo = mini.getbyName("FClassNo").getValue();
            var mMemberID = mini.getbyName("FMemberNumber").getValue();
            var mCasherID = mini.getbyName("FUserID").getValue();
            var mStockID = mini.getbyName("FStockID").getValue();
            var mGoodsID = mini.getbyName("FGoodItemID").getValue();
            var mGuiderID = mini.getbyName("FGuiderNumber").getValue();
            var mBrandID = mini.getbyName("FSupplyItemID").getValue();
            var mDataType = mini.getbyName("FBillType").getValue();
            
            var json = "[{";
            json = json + '"mListType":' + '"5",';//列表类型
            json = json + '"mSystemAppID":' + '"' + uID + '",';
            json = json + '"mDateTime1":' + '"' + cDateTime1 + '",';
            json = json + '"mDateTime2":' + '"' + cDateTime2 + '",';
            json = json + '"mCasherID":' + '"' + mCasherID + '",';
            json = json + '"mStockID":' + '"' + mStockID + '",';
            json = json + '"mMemberID":' + '"' + mMemberID + '",';            
            json = json + '"mClassNo":' + '"' + mClassNo + '",';
            json = json + '"mGoodsID":' + '"' + mGoodsID + '",';
            json = json + '"mGuiderID":' + '"' + mGuiderID + '",';
            json = json + '"mBrandID":' + '"' + mBrandID + '",';
            json = json + '"mDataType":' + '"' + mDataType + '",';
            json = json + '"mBillNo":' + '"' + mBillNo + '"';
            json = json + "}]";

            grid.load({ mydata: json });

            mExportDataUrl = grid.url;
            mExportDataJson = json;//导出
        }

        function printdata() {
            var url = "../Report/PrintReport";
            mini.open({
                url: url,
                title: "打印", width: 1000, height: 700,
                onload: function () {
                    var iframe = this.getIFrameEl();
                    var NoneDisplayCol = [];
                    iframe.contentWindow.InitalPrint(grid, NoneDisplayCol, parent.window.getSystemCompany() + "零售收银流水表");
                }
            });
        }

    </script>

    </form>
</body>
